package com.cs.springcloud.controller;

import com.cs.springcloud.entities.Dept;
import com.cs.springcloud.service.DeptClientService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * DeptControllerFeign
 *
 * @author zzc
 * @version 1.00
 * @Date 2019/3/19-21:02
 */
@RestController
public class DeptControllerFeign {
    //    private static final String REST_URL_PREFIX = "http://localhost:8001";
    /**
     * 关于rest请求服务名称
     */
    //private static final String REST_URL_PREFIX = "http://microservicecloud-dept";

    @Autowired
    DeptClientService deptClientService;

    @RequestMapping(value = "/consumer/dept/add")
    public boolean add(Dept dept) {
        return deptClientService.add(dept);
    }

    @RequestMapping(value = "/consumer/dept/get/{id}")
    public Dept get(@PathVariable("id") Long id) {
        return deptClientService.get(id);
    }

    @RequestMapping(value = "/consumer/dept/list")
    public List<Dept> list() {
        return deptClientService.list();
    }

}
